Window Install MinGW
2020-10-29

0x1 What is MinGW

mingw.org

MinGW, a contraction of "Minimalist GNU for Windows", is a minimalist development environment for native Microsoft Windows applications.

0x2 What is MSYS

msys2.org

MSYS, a contraction of "Minimal SYStem", is a Bourne Shell command line interpreter system. Offered as an alternative to Microsoft's cmd.exe, this provides a general purpose command line environment, which is particularly suited to use with MinGW, for porting of many Open Source applications to the MS-Windows platform; a light-weight fork of Cygwin-1.3, it includes a small selection of Unix tools, chosen to facilitate that objective.

0x3 安装步骤

  1. 使用清华大学开源软件镜像站下载msys2
  2. 找到右侧获取下载链接->选择应用软件->找到MYSY2->下载(MSYS2 Windows, i686
  3. 安装
  4. 我们安装 MYSY2 是因为内部包含了 mingwpacman 包管理器
  5. 配置环境变量 把 {installdir}/msys32/mingw32/bin 添加到环境变量

0x4 配置 pacman

参考 MSYS2 镜像使用帮助
编辑 /etc/pacman.d/mirrorlist.mingw32 ,在文件开头添加:

Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686

然后执行 pacman -Sy 刷新软件包数据即可

0x5 配置make

有了 pacman 我们可以非常简单的管理包

  • pacman -Ss {name} 查找需要安装包的名称
  • pacman -S {name1} {name2} {name3} 安装单个或单个包

常用编译包 pcre-devel openssl-devel gcc curl mingw32-make wget g++

pacman -S mingw-w64-i686-gcc mingw-w64-i686-make mingw-w64-i686-gdb mingw-w64-i686-wget mingw-w64-i686-gcc-fortran mingw-w64-i686-curl openssl-devel pcre-devel msys/openssh

0x6 附:镜像站